
package com.carsite.service.impl;

import java.util.List;

import com.carsite.service.impl.BaseManager;
import com.carsite.model.Product;
import com.carsite.dao.ProductDao;
import com.carsite.service.ProductManager;

public class ProductManagerImpl extends BaseManager implements ProductManager {
    private ProductDao dao;

    /**
     * Set the Dao for communication with the data layer.
     * @param dao
     */
    public void setProductDao(ProductDao dao) {
        this.dao = dao;
    }

    /**
     * @see com.carsite.service.ProductManager#getProducts(com.carsite.model.Product)
     */
    public List getProducts(final Product product) {
        return dao.getProducts(product);
    }

    /**
     * @see com.carsite.service.ProductManager#getProduct(String id)
     */
    public Product getProduct(final String id) {
        return dao.getProduct(new Integer(id));
    }

    /**
     * @see com.carsite.service.ProductManager#saveProduct(Product product)
     */
    public void saveProduct(Product product) {
        dao.saveProduct(product);
    }

    /**
     * @see com.carsite.service.ProductManager#removeProduct(String id)
     */
    public void removeProduct(final String id) {
        dao.removeProduct(new Integer(id));
    }
}
